﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace gt.framework.Security
{
    public class MD5Cryptographyer:ICryptography
    {
        public string Decrypt(string encryptedString)
        {
            throw new NotImplementedException();
        }

        public string Encrypt(string normalString)
        {
            byte[] data = UnicodeEncoding.UTF8.GetBytes(normalString);
            using (MD5 md5 = new MD5CryptoServiceProvider())
            {
                byte[] md5data = md5.ComputeHash(data);
                md5.Clear();
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < md5data.Length; i++)
                {
                    sb.Append(md5data[i].ToString("x2"));
                }
                return sb.ToString();
            }
        }
    }
}
